package model.EventProperties;

import android.hardware.SensorEvent;
import Enums.MotionType;
import model.Interface.IeventProperties;
import MotionDetection.*;

public class MotionEventProperties implements IeventProperties {
	private MotionType motionType;
	private MotionDetector detector;
	

	public MotionDetector getDetector() {
		return detector;
	}

	public void setDetector(MotionDetector detector) {
		this.detector = detector;
	}

	public MotionType getMotionType() {
		return motionType;
	}

	public void setMotionType(MotionType motionType) {
		this.motionType = motionType;
		switch (motionType) {
		case WheelLeft:
			detector = new LeftTurnWheel();
			break;
		case WheelRight:
			detector = new RightTurnWheel();
			break;
		case Shake:
			detector = new LeftTurnWheel();
			break;//Untill we'll decode shake
		default:
			break;
		}
	}
	
	public MotionEventProperties(MotionType mt) {
		setMotionType(mt);
	}
	
	public boolean detectMotion(SensorEvent e)
	{
		return detector.detectMotion(e);
	}
}

